package com.example.sxt_practise.java基础;

/**
 * @author gaofeng
 * date 2022年03月19日 15:51
 */
public class SimpleDotCom {

    int[] locationCells ;
    int numOfHits = 0 ;

    public void setLocationCells(int[] locationCells) {
        this.locationCells = locationCells;
    }

    public String checkYourSelf(String guessString) {
        Integer guess = Integer.valueOf(guessString);
        String result = "miss" ;
        for (int cell : locationCells) {
            if (guess.equals(cell)) {
                result = "hit" ;
                numOfHits ++ ;
                break;
            }
        }
        if (numOfHits == locationCells.length) {
            result = "kill" ;
        }
        return result ;
    }
}
